<?php 
$user=$session->read('User');
?>
<div class="site_map">
    <ol>
        <?php 
            echo "<li class='home'>";
            $cll=strtolower($controller);
            $url='/'.$cll.'/index';
            if($user['cid'] || @$user['cgid']){
                $url='javascript:void(0)';
            }
			
            echo $html->link(__($cll,true),$url);
            echo "</li>";
            
			$flags=false;
            $pname="";

			foreach($objmenu as $key=>$menu)
            {
                if(!empty($menu["pagelist"])){
                     $objpage=$menu["pagelist"];
                     if(!empty($objpage)){
                         foreach($objpage as $pagename){
                            if($pagename==$actions){
                                $flags=true;
                                $pname=$pagename;
                            }
                         }
                     }
                }
                if($key==$actions || $flags){
                    $selected="";
                    $ps=false;
                    if(!empty($industry)){$flags=true;}
                    elseif(!empty($_GET['education'])){$flags=true;$ps=true;}
                    elseif(!empty($_GET['persontype'])){$flags=true;$ps=true;}
                    elseif(!empty($_GET['ptype'])){$flags=true;$ps=true;}
                    elseif(!empty($_GET['forbid'])){$flags=true;$ps=true;}
                    elseif(isset($_GET['state'])){$flags=true;$ps=true;}
                    elseif(!empty($declaretype)){$flags=true;}
                    if($flags){$selected="home";}
                    echo "<li class='".$selected."'>";
                    
                    $url='/'.$cll.'/'.$key;
                    if(!empty($menu["url"])){
                         $url=$menu["url"];
                    }
                    if($flags){
                        $menustr=$menu["str"];         
                        if($user['cid']){
                            $url='/companys/showinfosummary/'.$user['cid'];
                            $menustr="企业汇总信息";
                        }
//                        if($user['cgid']){
//                            $url='/colleages/showcolleageinfo/'.$user['cgid'];
//                            $menustr="高校基本信息";
//                        }
                        echo $html->link($menustr,$url);
                    }else{
                        
                        echo $menu["str"];
                    }
                    echo "</li>";
                    if($controller == 'Companys' || $controller == 'Reports' ||($controller == 'Searchs' && $key == 'servicesummary')){
                        if(!empty($menu["submenu"])){
                            $objtindex=$menu["submenu"];
                            foreach($objtindex as $key=>$tindex)
                            {
                                $cll=strtolower($controller);
                                $urls='/'.$cll.'/'.$key;
                                if($key==$actions){
                                    echo "<li class='home'>";
                                    if($actions=="editpage" || $actions=="edittrackinfo" || !empty($_GET['industry'])){
                                        $ps=true;
                                    }
                                    if($ps){
                                        echo $html->link($tindex["str"],$urls);
                                    }else{
                                        echo $tindex["str"];
                                    }
                                    echo "</li>";
                                }
                                if($actions == "protypereport"){
                                    $protype_url = $_SERVER["REQUEST_URI"];
                                    $protype_menu = explode("/",$key);
                                    $protype_url = explode("/",$protype_url);
                                    if(array_pop($protype_menu)==array_pop($protype_url)){
                                        echo "<li class='home'>";
                                        echo $tindex["str"];
                                        echo "</li>";
                                    }
                                }
                                if(!empty($tindex["pagelist"])){
                                     $objpage=$tindex["pagelist"];
                                     if(!empty($objpage)){
                                         foreach($objpage as $pagename){
                                            if($pagename==$actions){
                                                echo "<li class='home'>";
                                                echo $html->link($tindex["str"],$urls);
                                                echo "</li>";
                                            }
                                         }
                                     }
                                }
                            }
                        }
                    }
                    if(!empty($industry)){
                        foreach($industrys as $key=>$strindustry){
                            if($industry==$key){
                                echo "<li>";
                                echo $strindustry;
                                echo "</li>";
                                break;
                            }
                        }
                    }elseif(!empty($_GET['education'])){
                        $educations=classregistry::init('Constant')->Education;
                        echo "<li>";
                        echo $educations[$_GET['education']];
                        echo "</li>";	
                        break;
                    }elseif(!empty($_GET['persontype'])){
                        $persontypes=classregistry::init('Constant')->Persontype;
                        echo "<li>";
                        echo $persontypes[$_GET['persontype']];
                        echo "</li>";	
                        break;
                    }elseif(!empty($_GET['ptype'])){
                        echo "<li>";
                        echo $patentname[$_GET['ptype']];
                        echo "</li>";	
                        break;
                    }elseif(!empty($_GET['forbid'])){
                        echo "<li>";
                        echo $forb[$_GET['forbid']];
                        echo "</li>";	
                        break;
                    }elseif(isset($_GET['state'])){
                        echo "<li>";
                        echo $str->getstausstr($_GET['state']);
                        echo "</li>";	
                        break;
                    }elseif(!empty($declaretype)){
                        if(!empty($declaretypes)){
                            foreach($declaretypes as $key=>$strdeclaretype){
                                if($declaretype==$key){
                                    echo "<li>";
                                    echo $strdeclaretype;
                                    echo "</li>";
                                    break;
                                }
                            }
                        }
                    }else if(!empty($tech)){
                        $objmenu=classregistry::init('Techstack')->getValue();
                        foreach($objmenu as $key=>$menu)
                        {  
                            if($key==$tech){
                                echo "<li>";
                                echo $menu;
                                echo "</li>";
                                break;
                            }
                        }
                    }
                    if($actions=="deplist"){
                        echo "<li>";
                        echo "项目投入清单";
                        echo "</li>";
                    }if($actions=="editdeplist" || $actions=="showdeplist"){
                        echo "<li class='home'>";
                        echo $html->link("项目投入清单","/companys/deplist");
                        echo "</li>";
                    }
                    if($actions=="moveinfo"){
                        echo "<li>";
                        echo "项目移交";
                        echo "</li>";
                    }
                    if($actions=="settechfilter" || $actions=="settalentfilter" || $actions=="setfinacefilter"){
                        if(empty($id)){
                            echo "<li class='home'>";
                            echo $html->link("自定义条件","/searchs/".$actions);
                            echo "</li>";
                            echo "<li>";
                            echo "添加";
                            echo "</li>";
                        }
                    }
                    if($flags){
                        $str_title="";
                        if(stripos($pname,"edit")>-1){
                            $str_title="添加";
                            if(!empty($id)){
                                $str_title="编辑";
                            }
                            if(stripos($pname,"editstitution")>-1){
                                $str_title.="机构";
                            }
                            if(stripos($pname,"editachieve")>-1 && !empty($_GET["sta"])){
                                $str_title.=$_GET["sta"]=="1"?"产出成果数":"获奖成果数";
                            }
                        }else if(stripos($pname,"add")>-1){
                            $str_title="添加";
                        }else if(stripos($pname,"show")>-1 || stripos($pname,"view")>-1){
                            $str_title="详细";
                            if(stripos($pname,"showstitution")>-1){
                                $str_title="研发机构";
                            }
                            if(stripos($pname,"showachieve")>-1 && !empty($_GET["status"])){
                                $str_title=$_GET["status"]=="1"?"产出成果数":"获奖成果数";
                            }
                        }else if(stripos($pname,"time")>-1){
                            $str_title="按年度显示";
                        }
                        if($str_title){
                            echo "<li>$str_title</li>";
                        }
                    }
                    break;
                }
            }
        ?>
    </ol>
</div>